<?php 
	include("head.php"); 
    include("conn.php");
    //需要对kid做一个验证
    $kid = empty($_GET["kid"])?"null":$_GET["kid"];
    if($kid=="null"){
        die("请输入正确的参数！");
    }
	//执行查询sql
    $sql = "select sid,学号,姓名,性别,生日,籍贯,手机号,班号,照片 from `student` where sid='{$kid}'";
    $result = mysqli_query($conn,$sql);
    if( mysqli_num_rows($result)>0 ){
		//转成关联数组，因为这里确定只有一条记录，所以不用while循环
		$arr = mysqli_fetch_assoc($result);
    }else{
        echo "找不到这条记录";
    }
?>
    <div class="sui-layout">
		  <div class="sidebar">
<?php include("leftmenu.php"); ?>	  	
		  </div>
          <div class="content">
		  <p class="sui-text-xxlarge my-padd">学生信息修改</p>
			<form enctype="multipart/form-data" action="xuesheng_save.php" method="post" class="sui-form form-horizontal sui-validate">
			  <input type="hidden" name="action" value="update">
			  <input type="hidden" name="id" value="<?php echo $arr['sid']?>">
			  <!-- <div class="control-group">
			    <label for="sids" class="control-label">sid：</label>
			    <div class="controls">
			      <input name="sids" type="text" id="sids" class="input-large input-fat" placeholder="输入sid" data-rules="required|minlength=0|maxlength=1000" value="">
			    </div>
			  </div> -->
			  <div class="control-group">
			    <label for="xuehao" class="control-label">学号：</label>
			    <div class="controls">
			      <input name="xuehao" type="text" id="xuehao" class="input-large input-fat" placeholder="输入学号" data-rules="required|minlength=2|maxlength=10" value="<?php echo $arr['学号']?>">
			    </div>
			  </div>
			  <div class="control-group">
			    <label for="names" class="control-label">姓名：</label>
			    <div class="controls">
			      <input name="names" type="text" id="names" class="input-large input-fat"  placeholder="输入学生姓名" data-rules="required|minlength=2|maxlength=10" value="<?php echo $arr['姓名']?>">
			    </div>
			  </div>
			  <div class="control-group">
			    <label for="sex" class="control-label">性别：</label>
			    <div class="controls">
				  <select name="sex" id="">
				    <option value="1"><?php echo $arr['性别']?"男":"女" ?></option>
					<option value="0"><?php echo $arr['性别']?"女":"男" ?></option>
				  </select>
			    </div>
			  </div>
			  <div class="control-group">
			    <label for="birthday" class="control-label">生日</label>
			    <div class="controls">
			      <input name="birthday" type="text" id="birthday" class="input-large input-fat"  data-toggle="datepicker" placeholder="输入学生生日" value="<?php echo $arr['生日']?>">
			    </div>
			  </div>
			  <div class="control-group">
			    <label for="jiguan" class="control-label">籍贯：</label>
			    <div class="controls">
			      <input name="jiguan" type="text" id="jiguan" class="input-large input-fat"  placeholder="输入学生籍贯" data-rules="required|minlength=2|maxlength=10" value="<?php echo $arr['籍贯']?>">
			    </div>
			  </div>
			  <div class="control-group">
			    <label for="iphone" class="control-label">手机号：</label>
			    <div class="controls">
			      <input name="iphone" type="text" id="iphone" class="input-large input-fat"  placeholder="输入学生手机号" data-rules="required|minlength=2|maxlength=11" value="<?php echo $arr['手机号']?>">
			    </div>
			  </div>
			  <div class="control-group">
			    <label for="banhao" class="control-label">班号：</label>
			    <div class="controls">
			      <input name="banhao" type="text" id="banhao" class="input-large input-fat"  placeholder="输入学生班号" data-rules="required|minlength=2|maxlength=20" value="<?php echo $arr['班号']?>">
			    </div>
			  </div>
			  <div class="control-group">
			    <label for="photo" class="control-label">照片：</label>
			    <div class="controls">
					<img src="<?php echo $arr['照片'] ?>" alt="" class="photo" >
				  <input name="photo" type="file" id="photo" class="input-large input-fat">
				  <input name="oldphoto" type="hidden" value="<?php echo $arr['照片']?>" class="input-large input-fat">
			    </div>
			  </div>				  
			  <div class="control-group">
			  	<label class="control-label"></label>
			  	<div class="controls">
			  		<input type="submit" value="修改" name="" class="sui-btn btn-large btn-primary">
			  	</div>
			  </div>	  
			</form>
		  </div>
		</div>		
    </div>
<?php include("foot.php"); ?>